package com.healer.controller;

import com.healer.common.AssembleResponseMsg;
import com.healer.pojo.ReturnBody;
import com.healer.service.SystemLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class SystemLogController {
    @Autowired
    SystemLogService systemLogService;

    /**
     * 功能描述：日志查询
     * @param map
     * @return
     */
    @RequestMapping("/queryloglist")
    public ReturnBody queryLogList(@RequestBody Map<String,Object> map){
        Map<String, Object> stringObjectMap = systemLogService.queryLogList(map);
        return new AssembleResponseMsg().success(stringObjectMap);
    }

    /**
     * 功能描述：删除日志
     * @param logId
     * @return
     */
   @RequestMapping("/deletelog")
    public ReturnBody deleteLog(String logId){
        int flag=systemLogService.deleteLog(logId);
        if(flag==1)
            return new AssembleResponseMsg().success("OK");
        else
            return new AssembleResponseMsg().failure(200,"error","日志删除失败");
   }
}
